package com.design.template;

import java.util.List;

/**
 * 基础电商推广服务
 * @author ytj
 * @date 2024/11/28 14:31
 */
public abstract class NetMall {
    private String uid;
    private String password;

    public NetMall(String uid,String password){
        this.uid=uid;
        this.password=password;
    }

    /**
     * 对外提供通用方法
     * */
    public void general(String url){
        boolean login = this.login(uid, password);
        if(!login){
            throw new RuntimeException("请先登录");
        }
        List<String> crawle = this.crawle(url);
        this.generated(crawle);
    }

    /**
     * 用户登录
     * */
    protected abstract boolean login(String uid,String password);

    /**
     * 爬取数据
     * */
    protected abstract List<String> crawle(String url);
    /**
     * 生成海报
     * */
    protected abstract void generated(List<String> list);
}
